package san;

public class Triangle {
    private int sideA;
    private int sideB;
    private int sideC;

    public Triangle() {
    }

    public Triangle(int a, int b, int c) throws myException {
        if (isTriangle(a, b, c)) {
            this.sideA = a;
            this.sideB = b;
            this.sideC = c;
        } else {
            throw new myException("不能构成三角形");
        }
    }
    private boolean isTriangle(int a, int b, int c) {
        return a + b > c && a + c > b && b + c > a;
    }

    public int getSideA() {
        return sideA;
    }

    public void setSideA(int sideA) {
        this.sideA = sideA;
    }

    public int getSideB() {
        return sideB;
    }

    public void setSideB(int sideB) {
        this.sideB = sideB;
    }

    public int getSideC() {
        return sideC;
    }

    public void setSideC(int sideC) {
        this.sideC = sideC;
    }

    @Override
    public String toString() {
        return "Triangle{sideA = " + sideA + ", sideB = " + sideB + ", sideC = " + sideC + "}";
    }
}
